﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// 管理器基类 不需要继承于mono
/// </summary>
/// <typeparam name="T"></typeparam>
public abstract class BaseManager<T> : Imanager where T : BaseManager<T>, new()
{
    private static T _instance;

    public static T Instance
    {
        get
        {
            if (_instance == null)
            {
                _instance = new T();
            }
            return _instance;
        }
    }

    public void InitManager()
    {
        var i = Instance;
        Instance.Init();
    }

    public void StartManager()
    {
        Instance.Start();
    }

    protected abstract void Init();

    protected abstract void Start(); 
}
interface Imanager
{
    void InitManager();
    void StartManager();
}